#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N = 0;
    scanf("%d", &N);
    int i = 0;
    int n = 0;
    int count = 0;
    for (i = 1; i <= N; i++) {
        int flat = 1;
        int number = i;
        while (number) {
            n = number % 10;
                if (flat % 2 == 1 && n % 2 == 1) {
                    flat++;
                }
                else if (flat % 2 == 0 && n % 2 == 0) {
                    flat++;
                }
                else {
                    count++;
                    break;
                }
             number = number / 10;
        }
    }
    printf("%d", N - count);
    return 0;
}